﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL.Entity;


namespace DAL.Persistencia
{
    public class MinimoNoiteDAL
    {

        private NewTierraEntities Con;

        public MinimoNoiteDAL()
        {
            Con = new NewTierraEntities();
        }

        public void Salvar(MinimoNoites m)
        {
            try
            {
                Con.AddToMinimoNoites(m);
                Con.SaveChanges();
            }
            catch 
            {                
                throw;
            }
        }

        public int RetornaLast()
        {
            try
            {
               return Convert.ToInt32(Con.MinimoNoites.OrderByDescending(m => m.MinimoNoites_id).First().MinimoNoites_qtd);
            }
            catch 
            {                
                throw;
            }
        }

    }
}
